package com.bjwl.service.impl;

import com.bjwl.dao.CardMapper;
import com.bjwl.pojo.Card;
import com.bjwl.pojo.CardDenomination;
import com.bjwl.pojo.CardStrip;
import com.bjwl.pojo.vo.OpenCardVo;
import com.bjwl.service.CardService;
import com.bjwl.service.CardStripService;
import com.bjwl.utils.PageBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: czc
 * @Date:Create：in 2020/4/29 11:25
 * @Description:
 * @Modified By：
 * @Version: 1.0
 */
@Service
public class CardServiceImpl implements CardService {

    @Autowired
    private CardMapper cardMapper;
    @Autowired
    private CardStripService cardStripService;

    @Override
    public void openCard(OpenCardVo openCardVo) {
        cardMapper.openCard(openCardVo);
    }

    @Override
    public List<Card> findAllCardList(Integer buid) {
        return cardMapper.findAllCardList(buid);
    }

    @Override
    public Card findCardById(Integer id) {
        return cardMapper.findCardById(id);
    }

    @Override
    public Card findCardByCardId(Integer cardtype,Integer cardid) {
        return cardMapper.findCardByCardId(cardtype,cardid);
    }
    @Override
    public List<CardDenomination> findCardAllCarddenomination() {
        return  cardMapper.findCardAllCarddenomination();
    }

    @Override
    public Float findDenominations(Integer cdid ) {
        return cardMapper.findDenominations(cdid );
    }

    @Override
    public Card SfindCardByCardId(Integer cardid) {
        return cardMapper.SfindCardByCardId(cardid);
    }

    //****************************
    @Override
    public PageBean<Card> findCardBybsid(Integer pageNum, Integer bsid, Integer cardid, String cardvalue, String wstarttime, String wendtime ,Integer state) {
        PageBean<Card> pageBean = new PageBean<Card>(pageNum,10,cardMapper.cardPaging(bsid,cardid,cardvalue,wstarttime,wendtime ,state));
        pageBean.setData(cardMapper.findCardBybsid(pageBean,bsid,cardid,cardvalue,wstarttime,wendtime,state));
        return pageBean;
    }

    @Override
    public void deleteCardStrip(Integer id) {
        cardMapper.deleteCardStrip(id);
    }

    @Override
    public List<Card> findAllCardId(Integer jsbuid) {
        return cardMapper.findAllCardId(jsbuid);
    }

    @Override
    public void updateCardByid(Card card) {
        cardMapper.updateCardByid(card);
    }


    //****************************

    @Override
    public void rechargeHoursCard(Card card) {
        cardMapper.rechargeHoursCard(card);

    }

    @Override
    public void rechargeMoneyCard(Card card) {
        cardMapper.rechargeMoneyCard(card);

    }

    //************************
    //创建家政卡
    @Override
    public void addCreateCard(Card card) {
        cardMapper.addCreateCard(card);
    }


}
